package com.example.wechat.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.project.core.text.Convert;
import com.example.project.utils.DateUtils;
import com.example.wechat.mapper.WechatGroupMemberMapper;
import com.example.wechat.model.WechatGroupMember;

/**
 * 微信群成员Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-11-12
 */
@Service
public class WechatGroupMemberService {

	@Autowired
	private WechatGroupMemberMapper wechatGroupMemberMapper;

	/**
	 * 查询微信群成员
	 * 
	 * @param id 微信群成员主键
	 * @return 微信群成员
	 */

	public WechatGroupMember selectWechatGroupMemberById(Long id) {
		return wechatGroupMemberMapper.selectWechatGroupMemberById(id);
	}

	/**
	 * 查询微信群成员列表
	 * 
	 * @param wechatGroupMember 微信群成员
	 * @return 微信群成员
	 */

	public List<WechatGroupMember> selectWechatGroupMemberList(WechatGroupMember wechatGroupMember) {
		return wechatGroupMemberMapper.selectWechatGroupMemberList(wechatGroupMember);
	}

	/**
	 * 新增微信群成员
	 * 
	 * @param wechatGroupMember 微信群成员
	 * @return 结果
	 */

	public int insertWechatGroupMember(WechatGroupMember wechatGroupMember) {
		wechatGroupMember.setCreateTime(DateUtils.curLocalDateTime());
		return wechatGroupMemberMapper.insertWechatGroupMember(wechatGroupMember);
	}

	/**
	 * 修改微信群成员
	 * 
	 * @param wechatGroupMember 微信群成员
	 * @return 结果
	 */

	public int updateWechatGroupMember(WechatGroupMember wechatGroupMember) {
		wechatGroupMember.setUpdateTime(DateUtils.curLocalDateTime());
		return wechatGroupMemberMapper.updateWechatGroupMember(wechatGroupMember);
	}

	/**
	 * 批量删除微信群成员
	 * 
	 * @param ids 需要删除的微信群成员主键
	 * @return 结果
	 */

	public int deleteWechatGroupMemberByIds(String ids) {
		return wechatGroupMemberMapper.deleteWechatGroupMemberByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除微信群成员信息
	 * 
	 * @param id 微信群成员主键
	 * @return 结果
	 */

	public int deleteWechatGroupMemberById(Long id) {
		return wechatGroupMemberMapper.deleteWechatGroupMemberById(id);
	}
}
